perm filename SEQ[L70,TES] blob sn#009939 filedate 1972-06-27 generic text, type T, neo UTF8
00100		LISP70 ENTITIES
00200		------ --------
00300	
00400	Every LISP70 entity has a type and may have properties.    There  are
00500	two broad categories of entities:  ATOMS and LISTS.
00600	
00700		LISP70 ATOMS
00800		------ -----
00900	
01000	There are two classes of atoms: RECORDS and TOKENS.  A record  has  a
01100	fixed  set of "fields" determined by its record type.  A token has no
01200	fields.  Thus, records of type PERSON have an AGE and NAME field. But
01300	tokens of types INTEGER, REAL, SYMBOL, and NULL have no fields.
01400	
01500	LENGTH(A)=0 iff A is an atom.
01600	
01700		LISP70 LISTS
01800		------ -----
01900	
02000	There are three list types: NULL, ARRAY, and PAIR.
02100	
02200	The only entity of type NULL is NIL.  NIL is both a list and an atom;
02300	no other entity has this dual status.
02400	
02500	A PAIR is created by CONS(A,D).
02600		CAR(CONS(A,D))=A	P[1] = CAR(P) if P is a PAIR
02700		CDR(CONS(A,D))=D	P[2:∞]  =  CDR(P)  if  P  is  a  PAIR
02800	CONS(A,B) is a list whose length is 1+LENGTH(B).
02900	
03000	An ARRAY is created by assigning a PAIR to an ARRAY  variable.    The
03100	PAIR  is  considered  a list and its elements are copied.  It is also
03200	possible to assign NIL or another ARRAY to  an  array  variable,  but
03300	this does not create a new array.
03400	
03500	If  X is an array, then X[I] is defined iff 1≤I≤LENGTH(X).  Otherwise
03600	it is an error (not a FAILURE). X[I:J] is always defined; i.e, X[3:2]
03700	= NIL.
03800	
03900	The  following  functions  succeed  for arrays and pairs but fail for
04000	atoms:
04100		FIRST(X) = if atom X then FAIL else X[1]
04200		REST(X) = if atom X then FAIL else X[2:∞]
04300		NEXT(ref X) = FIRST(VALUE(X)) prog1 SET(X,REST(VALUE(X)))
     

00100		LISP70 STREAMS
00200		------ -------
00300	
00400	A  stream  is  a  list  without  its  outer  parentheses.   It is not
00500	"created" -- it is the same structure as the list it came from,  only
00600	"naked".  STRIP(L)  is  a stream whose elements are the elements of L
00700	and whose properties are the properties of L.  It just does not  have
00800	the outer parentheses of L.
00900	
01000	STRIP(NIL) = VAC, which is an atom.  LENGTH(VAC)=0.  TYPE(VAC)=VOID.
01100	
01200	If  P  is  a  PAIR  or  ARRAY, then TYPE(STRIP(P)) = STRIPPED PAIR or
01300	STRIPPED ARRAY.   FIRST, REST, NEXT, and subscripting are defined  as
01400	for PAIRS and ARRAYS.
01500	
01600	A stream can not occur in a list, because if S is a stream, then
01700		CONS(S,L) = if ¬L then CLOTHE(S)
01800			    else if ¬S then L else CAR(S) cons CONS(CDR(S),L).
01900	
02000	The argument "list" of a function is really a STREAM.
02100	
02200	STREAM FUNCTIONS returns STREAM values.  No other  functions  can  do
02300	this.
02400	
02500	STREAM  VARIABLES are bound to STREAM values.  No other variables can
02600	be.
02700	
02800	STREAM FIELDS contain STREAM values.  No other fields can have them.
02900	
03000	A property of an entity can not be a STREAM.  An element  of  a  list
03100	can not be a STREAM.
03200	
03300		LISP70 STRINGS
03400		------ -------
03500	
03600	A string is a CHARACTER ARRAY.  A CHARACTER is any atom  whose  PNAME
03700	is a string of length one.
03800	
03900		LISP70 FILES
04000		------ -----
04100	
04200	A file is a TOKEN ARRAY with a "scanner".  The scanner helps FIRST(F)
04300	figure  out which token is represented by the first few characters on
04400	the file.
04500	
04600	FIRST(F) may be called alternately with CHANGE SCANNER OF F TO  S  to
04700	look at the same characters with different scanners.
04800	
04900	A file is created by assigning DSK(<file name>) to a FILE variable. A
05000	string can also be assigned to a FILE variable  so  that  it  can  be
05100	scanned as a TOKEN ARRAY.